package com.starleague.battletech.unit.mech;

import com.starleague.battletech.BattletechException;
import com.starleague.battletech.game.IBattletechGame;
import com.starleague.battletech.game.IBattletechTeam;
import com.starleague.battletech.unit.BattletechUnitEngineType;
import com.starleague.battletech.unit.BattletechUnitInternalStructureType;
import com.starleague.battletech.unit.IPilot;
import com.starleague.battletech.unit.IWeight;

public interface IMechFactory
{
    /**
     * Only used for Mech construction. Arms will allocate Actuators based on
     * this field
     */
    public static enum WhichArmActuators
    {
        LOWER_ARM_AND_HAND,
        LOWER_ARM,
        NEITHER
    }

    IBipedMech createBipedMech(IBattletechGame game,
                               IBattletechTeam team,
                               IPilot pilot,
                               IWeight weight,
                               int walkMovementPoints,
                               BattletechUnitInternalStructureType internalStructureType,
                               BattletechUnitEngineType engineType,
                               WhichArmActuators leftArmActuators,
                               WhichArmActuators rightArmActuators)
            throws BattletechException;

    IQuadrupedMech createQuadrupedMech(IBattletechGame game,
                                       IBattletechTeam team,
                                       IPilot pilot,
                                       IWeight weight,
                                       int walkMovementPoints,
                                       BattletechUnitInternalStructureType internalStructureType,
                                       BattletechUnitEngineType engineType)
            throws BattletechException;
}
//

//
// private boolean FillInCriticalSlots(final MechEngine i_mech_engine)
// {
// if (center_torso.addCriticalSlot(i_mech_engine)
// && left_torso.addCriticalSlot(i_mech_engine)
// && right_torso.addCriticalSlot(i_mech_engine))
// {
// return true;
// }
// // else
// center_torso.removeCriticalSlot(i_mech_engine);
// left_torso.removeCriticalSlot(i_mech_engine);
// right_torso.removeCriticalSlot(i_mech_engine);
// return false;
// }
//
// private boolean FillInCriticalSlots(final MechGyro i_mech_gyro)
// {
// return center_torso.addCriticalSlot(i_mech_gyro);
// }
//
// private boolean FillInCriticalSlots(final ICriticalSlot.Anywhere i_critical_slot_anywhere, final int i_num_slots)
// {
// int slots_to_fill = i_num_slots;
// for (MechHitLocation mech_hit_location : this.mech_hit_location_set)
// {
// slots_to_fill -= mech_hit_location.addCriticalSlot(i_critical_slot_anywhere, slots_to_fill);
// }
//
// return (slots_to_fill == 0);
// }
//
// private int CalculateAllFreeSlots()
// {
// int free_slots = 0;
// for (MechHitLocation mech_hit_location : this.mech_hit_location_set)
// {
// free_slots += mech_hit_location.getNumFreeSlots();
// }
// return free_slots;
// }
//
// protected boolean AddTo(final MechHitLocation i_mech_hit_location, final ICriticalSlot.Single i_critical_slot_single)
// {
// int total_free_slots = CalculateAllFreeSlots();
// if (total_free_slots < i_critical_slot_single.getNumCriticalSlots())
// return false;
//
// int available_slots = i_mech_hit_location.getNumFreeSlots() + i_mech_hit_location.getNumAnywhereSlots();
// if (available_slots < i_critical_slot_single.getNumCriticalSlots())
// return false;
//
// // We should have room for the ICriticalSlot.Single (TODO: Assuming no synchronization issues)
// Set<ICriticalSlot.Anywhere> slot_anywhere_set = i_mech_hit_location.removeAllAnywhereSlots();
//
// // Add the new ICriticalSlot.Single
// i_mech_hit_location.addCriticalSlot(i_critical_slot_single);
//
// for (ICriticalSlot.Anywhere slot_anywhere : slot_anywhere_set)
// {
// FillInCriticalSlots(slot_anywhere, 1);
// }
//
// return true;
// }
//
// protected void AddToLimbSet(final MechHitLocation i_mech_hit_location)
// {
// this.mech_hit_location_set.add(i_mech_hit_location);
// this.mech_hit_location_set.add(this.center_torso);
// this.mech_hit_location_set.add(this.left_torso);
// this.mech_hit_location_set.add(this.right_torso);
// }

// @OneToMany(cascade=CascadeType.ALL)
// private Set<battletech.HeatSink> heat_sink_set = new HashSet<battletech.HeatSink>();
//
// @OneToMany(cascade=CascadeType.ALL)
// private Set<JumpJet> jump_jet_set = new HashSet<JumpJet>();

//
// Derived Instance Variables
//

//
// Grid related Instance Variables
//
// @Enumerated(EnumType.STRING)
// HexDirection direction_facing;
//
// @Enumerated(EnumType.STRING)
// private LeggedMovement.TYPE legged_movement_type;
// private int walk_mp;
// @Transient
// LeggedMovement legged_movement;
// private battletech.movement.Jump this.movement_jump;

// @Transient
// @OneToMany(cascade=CascadeType.ALL)
// Set<MechHitLocation> mech_hit_location_set = new HashSet<MechHitLocation>(8);

// IS/Armor related Instance Variables
// private final Map<battletech.HitLocation.TYPE, battletech.HitLocation> this.hit_location_map;
// }

//
//
//

// switch(this.movement_type)
// {
// case BIPED:
// this.movement_legs = battletech.movement.Legs.CreateBiped(this.walk_mp);
// break;
// case QUADRUPED:
// this.movement_legs = battletech.movement.Legs.CreateQuadruped(this.walk_mp);
// break;
// // default:
// // throw new BattletechException(
// // "Mech.ctor(): invalid movement_type: " + i_movement_type);
// }

// this.heat_sink_set.addAll(i_mech_designer.getHeatSinkSet());
// this.jump_jet_set.addAll(i_mech_designer.getJumpJetSet());

//
// Add other items
//

//
// Add critical slots
//
// for(MechDesigner.WHERE where_loc : MechDesigner.WHERE.values())
// {
// ICriticalSlot[] critical_slot_array = i_mech_designer.getCriticalSlots(where_loc);
// HitLocation hit_location = null;
//
// switch(where_loc)
// {
// case HEAD:
// hit_location = this.head;
// break;
// case CENTER_TORSO:
// hit_location = this.center_torso;
// break;
// case LEFT_TORSO:
// hit_location = this.left_torso;
// break;
// case RIGHT_TORSO:
// hit_location = this.right_torso;
// break;
// case LEFT_ARM:
// hit_location = this.left_arm;
// break;
// case RIGHT_ARM:
// hit_location = this.right_arm;
// break;
// case LEFT_LEG:
// hit_location = this.left_leg;
// break;
// case RIGHT_LEG:
// hit_location = this.right_leg;
// break;
// }
//
// if (hit_location != null)
// for (ICriticalSlot i_slot : critical_slot_array)
// hit_location.addToCriticalSlots(i_slot, 1);
// }

// TODO: Call InitializeDependentVariables(Movement, critical slots, part damage, etc..)

//
//
// public Mech(final String i_name, final MechDesigner i_mech_designer) throws BattletechException
// {
// super(); // Not placed on grid yet
//
// if (i_mech_designer == null)
// throw new BattletechException("Mech.ctor(): i_mech_designer is null");
//
// this.name = i_name;
// //_mech_model = i_mech_model;
//
// this.chassis_name = i_mech_designer.chassis_name;
// this.model_name = i_mech_designer.model_name;
// this.mech_tons = i_mech_designer.mech_tons;
//
// // Grid related Instance Variables
// this.direction_facing = null;
//
// //
// //
// //
//
// this.mech_internal_structure = i_mech_designer.getMechInternalStructure();
// this.mech_armor = i_mech_designer.getMechArmor();
// this.mech_engine = i_mech_designer.getMechEngine();
// this.mech_gyro = i_mech_designer.getMechGyro();
//
// this.head = new Head(
// this.mech_internal_structure,
// i_mech_designer.getArmorForHitLocation(MechDesigner.WHERE.HEAD));
//
// this.center_torso = new CenterTorso(
// this.mech_internal_structure,
// i_mech_designer.getArmorForHitLocation(MechDesigner.WHERE.CENTER_TORSO));
//
// this.left_torso = new SideTorso(
// this.mech_internal_structure,
// i_mech_designer.getArmorForHitLocation(MechDesigner.WHERE.LEFT_TORSO));
//
// this.right_torso = new SideTorso(
// this.mech_internal_structure,
// i_mech_designer.getArmorForHitLocation(MechDesigner.WHERE.RIGHT_TORSO));
//
// this.left_arm = new Arm(
// i_mech_designer.getLeftArmActuators(),
// this.mech_internal_structure,
// i_mech_designer.getArmorForHitLocation(MechDesigner.WHERE.LEFT_ARM));
//
// this.right_arm = new Arm(
// i_mech_designer.getRightArmActuators(),
// this.mech_internal_structure,
// i_mech_designer.getArmorForHitLocation(MechDesigner.WHERE.RIGHT_ARM));
//
// this.left_leg = new Leg(
// this.mech_internal_structure,
// i_mech_designer.getArmorForHitLocation(MechDesigner.WHERE.LEFT_LEG));
//
// this.right_leg = new Leg(
// this.mech_internal_structure,
// i_mech_designer.getArmorForHitLocation(MechDesigner.WHERE.RIGHT_LEG));
//
// switch(i_mech_designer.movement_type)
// {
// case BIPED:
// this.movement_legs = battletech.movement.Legs.CreateBiped(i_mech_designer.getWalkMP());
// break;
// case QUADRUPED:
// this.movement_legs = battletech.movement.Legs.CreateQuadruped(i_mech_designer.getWalkMP());
// break;
// default:
// throw new BattletechException(
// "Mech.ctor(): invalid movement_type: " + i_mech_designer.movement_type);
// }
//
// this.heat_sink_set.addAll(i_mech_designer.getHeatSinkSet());
// this.jump_jet_set.addAll(i_mech_designer.getJumpJetSet());
//
// //
// // Add other items
// //
//
// //
// // Add critical slots
// //
// for(MechDesigner.WHERE where_loc : MechDesigner.WHERE.values())
// {
// ICriticalSlot[] critical_slot_array = i_mech_designer.getCriticalSlots(where_loc);
// HitLocation hit_location = null;
//
// switch(where_loc)
// {
// case HEAD:
// hit_location = this.head;
// break;
// case CENTER_TORSO:
// hit_location = this.center_torso;
// break;
// case LEFT_TORSO:
// hit_location = this.left_torso;
// break;
// case RIGHT_TORSO:
// hit_location = this.right_torso;
// break;
// case LEFT_ARM:
// hit_location = this.left_arm;
// break;
// case RIGHT_ARM:
// hit_location = this.right_arm;
// break;
// case LEFT_LEG:
// hit_location = this.left_leg;
// break;
// case RIGHT_LEG:
// hit_location = this.right_leg;
// break;
// }
//
// if (hit_location != null)
// for (ICriticalSlot i_slot : critical_slot_array)
// hit_location.addToCriticalSlots(i_slot, 1);
// }
// }

// public void SetFacingDirection(final HexDirection i_direction_facing)
// {
// this.direction_facing = i_direction_facing;
// }

//
//
//

// public Mech(final SerialObject.SerialManager i_sobject_manager, final Mech.SerialData i_mech_data)// throws
// BattletechException
// {
// super(i_sobject_manager, i_mech_data);
//
// this.name = i_mech_data._name;
// this.chassis_name = i_mech_data._chassis_name;
// this.model_name = i_mech_data._model_name;
// this.mech_tons = i_mech_data._mech_tons;
//
// // Grid related Instance Variables
// this.direction_facing = i_mech_data._direction_facing;
//
// //
// //
// //
//
// this.mech_internal_structure = i_mech_data._mech_internal_structure_data.Deserialize(i_sobject_manager);
// this.mech_armor = i_mech_data._mech_armor_data.Deserialize(i_sobject_manager);
// this.mech_engine = i_mech_data._mech_engine_data.Deserialize(i_sobject_manager);
// this.mech_gyro = i_mech_data._mech_gyro_data.Deserialize(i_sobject_manager);
//
// this.head = i_mech_data._head_data.Deserialize(i_sobject_manager);
// this.center_torso = i_mech_data._center_torso_data.Deserialize(i_sobject_manager);
// this.left_torso = i_mech_data._left_torso_data.Deserialize(i_sobject_manager);
// this.right_torso = i_mech_data._right_torso_data.Deserialize(i_sobject_manager);
// this.left_arm = i_mech_data._left_arm_data.Deserialize(i_sobject_manager);
// this.right_arm = i_mech_data._right_arm_data.Deserialize(i_sobject_manager);
// this.left_leg = i_mech_data._left_leg_data.Deserialize(i_sobject_manager);
// this.right_leg = i_mech_data._right_leg_data.Deserialize(i_sobject_manager);
//
// this.movement_legs = i_mech_data._movement_legs_data.Deserialize(i_sobject_manager);
//
// for (HeatSink.SerialData heat_sink_data : i_mech_data._heat_sink_data_set)
// this.heat_sink_set.add(heat_sink_data.Deserialize(i_sobject_manager));
//
// for (JumpJet.SerialData jump_jet_data : i_mech_data._jump_jet_data_set)
// this.jump_jet_set.add(jump_jet_data.Deserialize(i_sobject_manager));
//
// //
// // Add other items
// //
// /*
// //
// // Add critical slots
// //
// for(MechDesigner.WHERE where_loc : MechDesigner.WHERE.values())
// {
// ICriticalSlotable[] critical_slot_array = i_mech_designer.getCriticalSlots(where_loc);
// HitLocation hit_location = null;
//
// switch(where_loc)
// {
// case HEAD:
// hit_location = this.head;
// break;
// case CENTER_TORSO:
// hit_location = this.center_torso;
// break;
// case LEFT_TORSO:
// hit_location = this.left_torso;
// break;
// case RIGHT_TORSO:
// hit_location = this.right_torso;
// break;
// case LEFT_ARM:
// hit_location = this.left_arm;
// break;
// case RIGHT_ARM:
// hit_location = this.right_arm;
// break;
// case LEFT_LEG:
// hit_location = this.left_leg;
// break;
// case RIGHT_LEG:
// hit_location = this.right_leg;
// break;
// }
//
// for (ICriticalSlotable i_slotable : critical_slot_array)
// hit_location.AddCriticalSlotable(i_slotable, 1);
// }
// */
// DEBUG("DESERIALIZED : " + this);
// }

//
// public void AddToGrid(
// final battletech.TerrainHex i_location_hex,
// final HexDirection i_direction_facing) // + state(standing, jumping, ...), etc...
// {
// this.direction_facing = i_direction_facing;
// super.SetLocationTerrainHex(i_location_hex);
// }
//
// public void WalkForward(final HexGrid<battletech.TerrainHex> i_hex_grid)
// {
// // TODO: Check values/MP
// SetLocationTerrainHex(i_hex_grid.getHexInDirection(getLocationTerrainHex(), this.direction_facing));
//
// //GetTeam().game.PostGameEvent(new battletech.event.EntityChangedEvent(this));
//
// /*
// public abstract battletech.MovementCost getMPCost(final Hex.Grid<battletech.TerrainHex> i_hex_grid,
// final battletech.TerrainHex i_src_hex,
// final Hex.Direction i_direction)
// throws battletech.Movement.Exception;
// */
// }
//
// public void TurnLeft()
// {
// this.direction_facing = this.direction_facing.getLeft();
// }
//
// public void TurnRight()
// {
// this.direction_facing = this.direction_facing.getRight();
// }

//
//
//

// @Override
// public Mech.SerialData Serialize(final SerialObject.SerialManager i_serial_manager)
// {
// return new Mech.SerialData(i_serial_manager, this);
// }
//
// public static class SerialData extends Entity.SerialData
// {
// final String this.name;
// final String this.chassis_name;
// final String this.model_name;
// final int this.mech_tons;
//
// final Head.SerialData this.head_data;
// final CenterTorso.SerialData this.center_torso_data;
// final SideTorso.SerialData this.left_torso_data;
// final SideTorso.SerialData this.right_torso_data;
// final Arm.SerialData this.left_arm_data;
// final Arm.SerialData this.right_arm_data;
// final Leg.SerialData this.left_leg_data;
// final Leg.SerialData this.right_leg_data;
//
// final MechInternalStructure.SerialData this.mech_internal_structure_data;
// final MechArmor.SerialData this.mech_armor_data;
// final MechEngine.SerialData this.mech_engine_data;
// final MechGyro.SerialData this.mech_gyro_data;
//
// final Set<HeatSink.SerialData> this.heat_sink_data_set = new HashSet<HeatSink.SerialData>();
// final Set<JumpJet.SerialData> this.jump_jet_data_set = new HashSet<JumpJet.SerialData>();
//
// final battletech.movement.Legs.SerialData this.movement_legs_data;
// //private battletech.movement.Jump this.movement_jump;
//
// // IS/Armor related Instance Variables
// //private final Map<battletech.HitLocation.TYPE, battletech.HitLocation> this.hit_location_map;
//
// // Grid related Instance Variables
// final HexDirection this.direction_facing;
//
//
// @Override
// public Mech Deserialize(final SerialObject.SerialManager i_serial_manager)// throws BattletechException
// {
// return (Mech)i_serial_manager.TrackSerialObject(new Mech(i_serial_manager, this), this);
// }
//
// SerialData(final SerialObject.SerialManager i_serial_manager, final Mech i_mech)
// {
// super(i_serial_manager, i_mech);
//
// this.name = i_mech._name;
// this.chassis_name = i_mech._chassis_name;
// this.model_name = i_mech._model_name;
// this.mech_tons = i_mech._mech_tons;
//
// this.head_data = i_mech._head.Serialize(i_serial_manager);
// this.center_torso_data = i_mech._center_torso.Serialize(i_serial_manager);
// this.left_torso_data = i_mech._left_torso.Serialize(i_serial_manager);
// this.right_torso_data = i_mech._right_torso.Serialize(i_serial_manager);
// this.left_arm_data = i_mech._left_arm.Serialize(i_serial_manager);
// this.right_arm_data = i_mech._right_arm.Serialize(i_serial_manager);
// this.left_leg_data = i_mech._left_leg.Serialize(i_serial_manager);
// this.right_leg_data = i_mech._right_leg.Serialize(i_serial_manager);
//
// this.mech_internal_structure_data = i_mech._mech_internal_structure.Serialize(i_serial_manager);
// this.mech_armor_data = i_mech._mech_armor.Serialize(i_serial_manager);
// this.mech_engine_data = i_mech._mech_engine.Serialize(i_serial_manager);
// this.mech_gyro_data = i_mech._mech_gyro.Serialize(i_serial_manager);
//
// for (HeatSink heat_sink : i_mech._heat_sink_set)
// this.heat_sink_data_set.add(heat_sink.Serialize(i_serial_manager));
//
// for (JumpJet jump_jet : i_mech._jump_jet_set)
// this.jump_jet_data_set.add(jump_jet.Serialize(i_serial_manager));
//
// this.movement_legs_data = i_mech._movement_legs.Serialize(i_serial_manager);
//
// this.direction_facing = i_mech._direction_facing;
// }
// }
// }
//
// //
// // Derived Instance Variables
// //
//
// private final battletech.movement.Legs this.movement_legs;
// //private battletech.movement.Jump this.movement_jump;
//
// // IS/Armor related Instance Variables
// //private final Map<battletech.HitLocation.TYPE, battletech.HitLocation> this.hit_location_map;
//
// // Grid related Instance Variables
// private HexDirection this.direction_facing;
//
//
// private final int grid_x;
// private final int grid_y;
// private final Terrain terrain;
// private final int elevation;
//
// private SerialData(final TerrainHex i_terrain_hex)
// {
// grid_x = i_terrain_hex.grid_x;
// grid_y = i_terrain_hex.grid_y;
// terrain = i_terrain_hex._terrain;
// elevation = i_terrain_hex._elevation;
// }
// }
// }
//
// }
//
//

// this.mech_internal_structure = new MechInternalStructure(i_mech_design.getInternalStructureType(), this.mech_tons);
// this.armor = i_mech_design.getArmor();
// this.engine = i_mech_design.getEngine();
// this.gyro = i_mech_design.getGyro();
//
// EnumMap<MechDesign.HIT_LOCATION, Integer> hit_location_armor_map = i_mech_design.getHitLocationArmorMap();
//
// this.head = new Head(_mech_internal_structure.getPointsInHitLocation(HitLocation.TYPE.HEAD),
// hit_location_armor_map.get(MechDesign.HIT_LOCATION.HEAD));
// this.center_torso = new CenterTorso(_mech_internal_structure.getPointsInHitLocation(HitLocation.TYPE.CENTER_TORSO),
// hit_location_armor_map.get(MechDesign.HIT_LOCATION.CENTER_TORSO));
// this.left_torso = new SideTorso(_mech_internal_structure.getPointsInHitLocation(HitLocation.TYPE.SIDE_TORSO),
// hit_location_armor_map.get(MechDesign.HIT_LOCATION.LEFT_TORSO));
// this.right_torso = new SideTorso(_mech_internal_structure.getPointsInHitLocation(HitLocation.TYPE.SIDE_TORSO),
// hit_location_armor_map.get(MechDesign.HIT_LOCATION.RIGHT_TORSO));
// this.left_arm = new Arm(_mech_internal_structure.getPointsInHitLocation(HitLocation.TYPE.ARM),
// hit_location_armor_map.get(MechDesign.HIT_LOCATION.LEFT_ARM), i_mech_design.getLeftArmActuators());
// this.right_arm = new Arm(_mech_internal_structure.getPointsInHitLocation(HitLocation.TYPE.ARM),
// hit_location_armor_map.get(MechDesign.HIT_LOCATION.RIGHT_ARM), i_mech_design.getLeftArmActuators());
// this.left_leg = new Leg(_mech_internal_structure.getPointsInHitLocation(HitLocation.TYPE.LEG),
// hit_location_armor_map.get(MechDesign.HIT_LOCATION.LEFT_LEG));
// this.right_leg = new Leg(_mech_internal_structure.getPointsInHitLocation(HitLocation.TYPE.LEG),
// hit_location_armor_map.get(MechDesign.HIT_LOCATION.RIGHT_LEG));
//
// AddToHitLocations(_mech_internal_structure, i_mech_design);
// AddToHitLocations(_engine, i_mech_design);
// AddToHitLocations(_gyro, i_mech_design);
//
// this.heat_sink_set = i_mech_design.getHeatSinkSet();
// for(battletech.HeatSink heat_sink : this.heat_sink_set)
// AddToHitLocations(heat_sink, i_mech_design);
//
// this.jump_jet_set = i_mech_design.getJumpJetSet();
// for(JumpJet jump_jet : this.jump_jet_set)
// AddToHitLocations(jump_jet, i_mech_design);
// //
// // // ...
//
// //
// //
// //
//
// switch(i_mech_design.movement_type)
// {
// case BIPED:
// this.movement_legs = battletech.movement.Legs.CreateBiped(i_mech_design.getWalkMP());
// break;
// case QUADRUPED:
// this.movement_legs = battletech.movement.Legs.CreateQuadruped(i_mech_design.getWalkMP());
// break;
// default:
// throw new BattletechException("Mech.ctor(): invalid movement_type: " + i_mech_design.movement_type);
// }
//
// /* TODO: Modular addition of jump jets?? Or add from template!?!? I think template is better!
// this.movement_jump = (i_mech_model.jump_mp > 0)
// ? battletech.movement.Jump.Create(i_mech_model.jump_mp)
// : null;
// */
// //
// // Handle non-volatile initialization
// //
//
// this.name = i_name;
// //_mech_model = i_mech_model;
//
// this.chassis_name = i_mech_design.chassis_name;
// this.model_name = i_mech_design.model_name;
// this.mech_tons = i_mech_design.mech_tons;
// //_heat_sinks = i_mech_model.heat_sinks;
//
// // Grid related Instance Variables
// this.direction_facing = null;
// }
// private Mech(final Mech.SerialData i_mech_data) throws BattletechException
// {
// this.name = i_name;
// //_mech_model = i_mech_model;
//
// this.chassis_name = i_mech_design.chassis_name;
// this.model_name = i_mech_design.model_name;
// this.mech_tons = i_mech_design.mech_tons;
// //_heat_sinks = i_mech_model.heat_sinks;
//
// // Grid related Instance Variables
// this.direction_facing = null;
// }
// }
//
//
// //
// //
// //
//
// /**
// * Create a Mech using the given MechDesign template
// */
// public Mech(final String i_name,
// final MechDesign i_mech_design) throws BattletechException
// {
// if (i_mech_design == null)
// throw new BattletechException("Mech.ctor(): i_mech_design is null");
//
// this.mech_internal_structure = i_mech_design.getMechInternalStructure();
// this.armor = i_mech_design.getArmor();
// this.engine = i_mech_design.getEngine();
// this.gyro = i_mech_design.getGyro();
//
// EnumMap<MechDesign.HIT_LOCATION, Integer> hit_location_armor_map = i_mech_design.getHitLocationArmorMap();
//
// this.head = new Head(_mech_internal_structure.getPointsInHitLocation(HitLocation.TYPE.HEAD),
// hit_location_armor_map.get(MechDesign.HIT_LOCATION.HEAD));
// this.center_torso = new CenterTorso(_mech_internal_structure.getPointsInHitLocation(HitLocation.TYPE.CENTER_TORSO),
// hit_location_armor_map.get(MechDesign.HIT_LOCATION.CENTER_TORSO));
// this.left_torso = new SideTorso(_mech_internal_structure.getPointsInHitLocation(HitLocation.TYPE.SIDE_TORSO),
// hit_location_armor_map.get(MechDesign.HIT_LOCATION.LEFT_TORSO));
// this.right_torso = new SideTorso(_mech_internal_structure.getPointsInHitLocation(HitLocation.TYPE.SIDE_TORSO),
// hit_location_armor_map.get(MechDesign.HIT_LOCATION.RIGHT_TORSO));
// this.left_arm = new Arm(_mech_internal_structure.getPointsInHitLocation(HitLocation.TYPE.ARM),
// hit_location_armor_map.get(MechDesign.HIT_LOCATION.LEFT_ARM), i_mech_design.getLeftArmActuators());
// this.right_arm = new Arm(_mech_internal_structure.getPointsInHitLocation(HitLocation.TYPE.ARM),
// hit_location_armor_map.get(MechDesign.HIT_LOCATION.RIGHT_ARM), i_mech_design.getLeftArmActuators());
// this.left_leg = new Leg(_mech_internal_structure.getPointsInHitLocation(HitLocation.TYPE.LEG),
// hit_location_armor_map.get(MechDesign.HIT_LOCATION.LEFT_LEG));
// this.right_leg = new Leg(_mech_internal_structure.getPointsInHitLocation(HitLocation.TYPE.LEG),
// hit_location_armor_map.get(MechDesign.HIT_LOCATION.RIGHT_LEG));
//
// AddToHitLocations(_mech_internal_structure, i_mech_design);
// AddToHitLocations(_engine, i_mech_design);
// AddToHitLocations(_gyro, i_mech_design);
//
// this.heat_sink_set = i_mech_design.getHeatSinkSet();
// for(battletech.HeatSink heat_sink : this.heat_sink_set)
// AddToHitLocations(heat_sink, i_mech_design);
//
// this.jump_jet_set = i_mech_design.getJumpJetSet();
// for(JumpJet jump_jet : this.jump_jet_set)
// AddToHitLocations(jump_jet, i_mech_design);
//
// // ...
//
// //
// //
// //
//
// switch(i_mech_design.movement_type)
// {
// case BIPED:
// this.movement_legs = battletech.movement.Legs.CreateBiped(i_mech_design.getWalkMP());
// break;
// case QUADRUPED:
// this.movement_legs = battletech.movement.Legs.CreateQuadruped(i_mech_design.getWalkMP());
// break;
// default:
// throw new BattletechException("Mech.ctor(): invalid movement_type: " + i_mech_design.movement_type);
// }
//
// /* TODO: Modular addition of jump jets?? Or add from template!?!? I think template is better!
// this.movement_jump = (i_mech_model.jump_mp > 0)
// ? battletech.movement.Jump.Create(i_mech_model.jump_mp)
// : null;
// */
// //
// // Handle non-volatile initialization
// //
//
// this.name = i_name;
// //_mech_model = i_mech_model;
//
// this.chassis_name = i_mech_design.chassis_name;
// this.model_name = i_mech_design.model_name;
// this.mech_tons = i_mech_design.mech_tons;
// //_heat_sinks = i_mech_model.heat_sinks;
//
// // Grid related Instance Variables
// this.direction_facing = null;
// }
//
// public String toString()
// {
// return "Mech [" + this.chassis_name + "] [" + this.model_name + "] " + super.toString();
// }
//
//
// public void WalkForward(final HexGrid<battletech.TerrainHex> i_hex_grid)
// {
// // TODO: Check values/MP
// SetLocationTerrainHex(i_hex_grid.getHexInDirection(getLocationTerrainHex(), this.direction_facing));
//
// //GetTeam().game.PostGameEvent(new battletech.event.EntityChangedEvent(this));
//
// /*
// public abstract battletech.MovementCost getMPCost(final Hex.Grid<battletech.TerrainHex> i_hex_grid,
// final battletech.TerrainHex i_src_hex,
// final Hex.Direction i_direction)
// throws battletech.Movement.Exception;
// */
// }
//
// public void TurnLeft()
// {
// }
//
// public void TurnRight()
// {
// }
//
// /*
// public battletech.TerrainHex getLocationHex()
// {
// return super.getLocationTerrainHex();
// }
// */
//
// //
// //
// //
//
// /**
// * Create a Mech using the given ModilInfo mech-template
// */
// private Mech(final Mech.SerialData i_mech_data) throws BattletechException
// {
// // this.internal_structure = i_mech_design.getInternalStructure();
// // this.armor = i_mech_design.getArmor();
// // this.engine = i_mech_design.getEngine();
// this.gyro = i_mech_data._gyro_data.Deserialize();
//
// this.head = i_mech_data._head_data.Deserialize();
// this.center_torso = i_mech_data._center_torso_data.Deserialize();
// this.left_torso = i_mech_data._left_torso_data.Deserialize();
// this.right_torso = i_mech_data._right_torso_data.Deserialize();
// this.left_arm = i_mech_data._left_arm_data.Deserialize();
// this.right_arm = i_mech_data._right_arm_data.Deserialize();
// this.left_leg = i_mech_data._left_leg_data.Deserialize();
// this.right_leg = i_mech_data._right_leg_data.Deserialize();
//
// // AddToHitLocations(_internal_structure, i_mech_design);
// // AddToHitLocations(_engine, i_mech_design);
// this.gyro.AddCriticalSlotsTo(this);
// //
// // this.heat_sink_list = i_mech_design.getHeatSinkList();
// // for(battletech.HeatSink heat_sink : this.heat_sink_list)
// // AddToHitLocations(heat_sink, i_mech_design);
// //
// // this.jump_jet_list = i_mech_design.getJumpJetList();
// // for(JumpJet jump_jet : this.jump_jet_list)
// // AddToHitLocations(jump_jet, i_mech_design);
// //
// // /// ...
//
//
//
// /*
// this.engine = new Engine(i_mech_template);
// this.engine.AddCriticalSlotsTo(_center_torso);
// this.engine.AddCriticalSlotsTo(_left_torso);
// this.engine.AddCriticalSlotsTo(_right_torso);
//
// this.gyro = new Gyro(_engine);
// this.gyro.AddCriticalSlotsTo(_center_torso);
// */
// //
// //
//
// this.movement_legs = i_mech_data._movement_legs_data.Deserialize();
// // switch(i_mech_design.movement_type)
// // {
// // case BIPED:
// // this.movement_legs = battletech.movement.Legs.CreateBiped(i_mech_design.getWalkMP());
// // break;
// // case QUADRUPED:
// // this.movement_legs = battletech.movement.Legs.CreateQuadruped(i_mech_design.getWalkMP());
// // break;
// // default:
// // throw new BattletechException("Mech.ctor(): invalid movement_type: " + i_mech_design.movement_type);
// // }
// //
// // /* TODO: Modular addition of jump jets?? Or add from template!?!? I think template is better!
// // this.movement_jump = (i_mech_model.jump_mp > 0)
// // ? battletech.movement.Jump.Create(i_mech_model.jump_mp)
// // : null;
// // */
// // //
// // // Handle non-volatile initialization
// // //
//
// this.name = i_mech_data._name;
// this.chassis_name = i_mech_data._chassis_name;
// this.model_name = i_mech_data._model_name;
// this.mech_tons = i_mech_data._mech_tons;
// //_heat_sinks = i_mech_model.heat_sinks;
//
// // Grid related Instance Variables
// this.direction_facing = i_mech_data._direction_facing;
// }
//
// private void AddToHitLocations(
// final ICriticalSlotable i_critical_slotable,
// final MechDesign i_mech_design) throws BattletechException
// {
// AddToHitLocations(i_critical_slotable, i_mech_design.getHitLocationsFor(i_critical_slotable));
// }
//
// private void AddToHitLocations(
// final ICriticalSlotable i_critical_slotable,
// final List<HitLocation> i_hit_location_list) throws BattletechException
// {
// for(MechDesign.HIT_LOCATION hit_location : i_mech_design.getHitLocationsFor(i_critical_slotable))
// {
// switch(hit_location)
// {
// case HEAD:
// this.head.AddCriticalSlotable(i_critical_slotable);
// break;
// case CENTER_TORSO:
// this.center_torso.AddCriticalSlotable(i_critical_slotable);
// break;
// case LEFT_TORSO:
// this.left_torso.AddCriticalSlotable(i_critical_slotable);
// break;
// case RIGHT_TORSO:
// this.right_torso.AddCriticalSlotable(i_critical_slotable);
// break;
// case LEFT_ARM:
// this.left_arm.AddCriticalSlotable(i_critical_slotable);
// break;
// case RIGHT_ARM:
// this.right_arm.AddCriticalSlotable(i_critical_slotable);
// break;
// case LEFT_LEG:
// this.left_leg.AddCriticalSlotable(i_critical_slotable);
// break;
// case RIGHT_LEG:
// this.right_leg.AddCriticalSlotable(i_critical_slotable);
// break;
// }
// }
// }
//
